how to find maximum value from an array